<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>通知管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {

	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</head>

<body>
	<ul class="nav nav-tabs">
		<li class="active"><a
			href="${ctx}/sys/notify/${notify.self?'self':''}">通知列表</a></li>
		<c:if test="${!notify.self}">
			<shiro:hasPermission name="sys:notify:edit">
				<li><a href="${ctx}/sys/notify/form">通知添加</a></li>
			</shiro:hasPermission>
		</c:if>
	</ul>
	<form:form id="searchForm" modelAttribute="notify"
		action="${ctx}/sys/notify/${notify.self?'self':''}" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<div>
			<label>标题：</label>
			<form:input path="title" htmlEscape="false" maxlength="200"
				class="input-medium" />

			<label>类型：</label>
			<form:select path="type" class="input-medium">
			<form:option value="" label=""/>
				<form:options items="${dic:getDictList('sys_notify_type')}"
					itemLabel="label" itemValue="value" htmlEscape="false" />
			</form:select>
			<c:if test="${!requestScope.notify.self}">
				<label>状态：</label> <form:radiobuttons path="status"
						items="${dic:getDictList('sys_notify_status')}"
						itemLabel="label" itemValue="value" htmlEscape="false" />
			</c:if>
			&nbsp;<input id="btnSubmit" class="btn btn-primary"
				type="submit" value="查询" />
		</div>
	</form:form>
	<tags:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>标题</th>
				<th>类型</th>
				<th>状态</th>
				<th>查阅状态</th>
				<th>更新时间</th>
				<c:if test="${!notify.self}">
					<shiro:hasPermission name="sys:notify:edit">
						<th>操作</th>
					</shiro:hasPermission>
				</c:if>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="notify">
				<tr>
					<td><a
						href="${ctx}/sys/notify/${requestScope.notify.self?'view':'form'}?id=${notify.id}">
							${fns:abbr(notify.title,50)} </a></td>
					<td>${dic:getDictLabel(notify.type, 'sys_notify_type','系统消息')}</td>
					<td>${dic:getDictLabel(notify.status, 'sys_notify_status','')}
					</td>
					<td><c:if test="${requestScope.notify.self}">
						${dic:getDictLabel(notify.readFlag, 'sys_notify_read','未读')}
					</c:if> <c:if test="${!requestScope.notify.self}">
						${notify.readNum} / ${notify.readNum + notify.unReadNum}
					</c:if></td>
					<td><fmt:formatDate value="${notify.createDate}"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<c:if test="${!requestScope.notify.self}">
						<shiro:hasPermission name="sys:notify:edit">
							<td><a href="${ctx}/sys/notify/form?id=${notify.id}">修改</a> <a
								href="${ctx}/sys/notify/delete?id=${notify.id}"
								onclick="return confirmx('确认要删除该通知吗？', this.href)">删除</a></td>
						</shiro:hasPermission>
					</c:if>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>